package com.example.dict;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyDatabaseHelper extends SQLiteOpenHelper {

    final String CREATE_TABLE_SQL = "create table dict(_id integer primary "
            + "key autoincrement , word , detail)" ;
    public MyDatabaseHelper(Context context,String name,int version){
        super(context,name,null,version);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        // 第一次使用数据库时自动建表
        sqLiteDatabase.execSQL(CREATE_TABLE_SQL);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
        System.out.println("-------------------------");
        System.out.println("---------onUpdate Called---------"
        + oldVersion + "--->" + newVersion);
        System.out.println("-------------------------");
    }
}
